IF EXISTS(SELECT name FROM sysobjects
      WHERE name = 'pOutProdDetail_Get' AND type = 'P')
   DROP PROCEDURE pOutProdDetail_Get
GO

CREATE PROCEDURE dbo.pOutProdDetail_Get
	@outProdPaperId AS INT
AS


/*______________________ CONSTANT DECLARATIONS _________________________*/

  

/*______________________ VARIABLE DECLARATIONS _________________________*/

  
/*_______________________________ INIT _________________________________*/


/*________________________ VALIDATE PARAMETERS _________________________*/
	
/*_______________________________ MAIN _________________________________*/
	
	SELECT p.[Name],
		ProductId = p.Id,
		pd.Amount ,
		pd.Id, 
		pd.InOutProdPaperId,
		p.ProductTypeId,
		p.ProducerId
	FROM dbo.InOutProdDetail pd 
	
	INNER JOIN dbo.Product p 
		ON pd.ProductId = p.Id
	
	WHERE pd.InOutProdPaperId  = @outProdPaperId
	ORDER BY pd.Id
/*___________________________ ERROR HANDLER ____________________________*/



